﻿<script type="text/javascript">
    var ip = "http://59.78.38.12:927";
    var roomidglobal;
    function go_into_room(roomid) {
        roomidglobal=roomid;
        var xmlhttp;

        xmlhttp = null;
        if (window.XMLHttpRequest) {// code for all new browsers
            xmlhttp = new XMLHttpRequest();
        }
        else if (window.ActiveXObject) {// code for IE5 and IE6
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if (xmlhttp != null) {
            xmlhttp.onreadystatechange = state_Change;
            xmlhttp.open("GET", ip+"/Home/Hall2/?roomid=" + roomid +
                         "&uname="+document.getElementById("uname").innerHTML , true);
            xmlhttp.send();
        }
        else {
            alert("Your browser does not support XMLHTTP.");
        }


        function state_Change() {
            if (xmlhttp.readyState == 4) {// 4 = "loaded"
                if (xmlhttp.status == 200) {// 200 = OK
                    // ...our code here...
                    if (xmlhttp.responseText == "yes") {
                        window.location = ip+"/Home/Room/?uname=" + 
                            document.getElementById("uname").innerHTML+"&roomid="+roomidglobal;
                    } else {
                        Messenger.options = {
                            extraClasses: 'messenger-fixed messenger-on-top',
                            theme: 'ice'
                        }
                        Messenger().post({
                            message: 'room is full.',
                            type: 'error',
                            showCloseButton: true
                        });
                    }
                }
            }
        }
    }
   
</script>


@{
    ViewBag.Title = "Hall";
}
<div class="container" style="background-image:url(@Url.Content("~/Images/back3.jpg"))">
<h2 style="color:white">Hall</h2>
<p  style="color:white"class="text-left">用户名:</p>
<p  style="color:white"class="text-left" id="uname">@ViewBag.name</p>
<table class = "table table-bordered @*table-hover*@ table-condensed @*table-striped*@">
  <tr>
    <th style="color:white">房间号</th>
    <th style="color:white">人数</th>
    <th style="color:white">最大人数</th>
    <th style="color:white">进入</th>
  </tr>
  <tr>
    <td style="color:white" id="roomid1">@ViewBag.roomid1</td>
    <td style="color:white" id="roomid1addnumber">@ViewBag.roomid1addnumber</td>
    <td style="color:white" id="roomid1number">@ViewBag.roomid1number</td>
    <td>
        <button class = "button glow button-pill button-flat-royal" id="roomid1entry" onmousedown ="go_into_room(1)">进入房间</button>
    </td>
  </tr>
  <tr>
    <td style="color:white" id="roomid2">@ViewBag.roomid2</td>
    <td style="color:white" id="roomid2addnumber">@ViewBag.roomid2addnumber</td>
    <td style="color:white" id="roomid2number">@ViewBag.roomid2number</td>
    <td>
        <button class = "button glow button-pill button-flat-royal" id="roomid2entry" onmousedown ="go_into_room(2)">进入房间</button>
    </td>
  </tr>
  <tr>
    <td style="color:white" id="roomid3">@ViewBag.roomid3</td>
    <td style="color:white" id="roomid3addnumber">@ViewBag.roomid3addnumber</td>
    <td style="color:white" id="roomid3number">@ViewBag.roomid3number</td>
    <td> 
        <button class = "button glow button-pill button-flat-royal" id="roomid3entry" onmousedown ="go_into_room(3)">进入房间</button>

  </tr>
  <tr>
    <td style="color:white" id="roomid4">@ViewBag.roomid4</td>
    <td style="color:white" id="roomid4addnumber">@ViewBag.roomid4addnumber</td>
    <td style="color:white" id="roomid4number">@ViewBag.roomid4number</td>
    <td> 
        <button class = "button glow button-pill button-flat-royal" id="roomid4entry" onmousedown ="go_into_room(4)">进入房间</button>
 </td>
  </tr>
  <tr>
    <td style="color:white" id="roomid5">@ViewBag.roomid5</td>
    <td style="color:white" id="roomid5addnumber">@ViewBag.roomid5addnumber</td>
    <td style="color:white" id="roomid5number">@ViewBag.roomid5number</td>
    <td>
        <button class = "button glow button-pill button-flat-royal" id="roomid5entry" onmousedown ="go_into_room(5)">进入房间</button>
</td>
  </tr>
  <tr>
    <td style="color:white" id="roomid6">@ViewBag.roomid6</td>
    <td style="color:white" id="roomid6addnumber">@ViewBag.roomid6addnumber</td>
    <td style="color:white" id="roomid6number">@ViewBag.roomid6number</td>
    <td> 
        <button class = "button glow button-pill button-flat-royal" id="roomid6entry" onmousedown ="go_into_room(6)">进入房间</button>
    </td>
  </tr>
  <tr>
    <td style="color:white" id="roomid7">@ViewBag.roomid7</td>
    <td style="color:white" id="roomid7addnumber">@ViewBag.roomid7addnumber</td>
    <td style="color:white" id="roomid7number">@ViewBag.roomid7number</td>
    <td> 
        <button class = "button glow button-pill button-flat-royal" id="roomid7entry" onmousedown ="go_into_room(7)">进入房间</button>
  </tr>
</table>
</div>
